package com.nehc.nettyserver.common;

/**
 * 系统常量定义
 * 
 * @author nehc
 * @date 2023-04-02
 */
public class Constants {

    /**
     * 消息类型
     */
    public static class MessageType {
        /**
         * 连接认证
         */
        public static final String AUTH = "AUTH";
        
        /**
         * 心跳
         */
        public static final String HEARTBEAT = "HEARTBEAT";
        
        /**
         * 业务消息
         */
        public static final String MESSAGE = "MESSAGE";
        
        /**
         * 广播消息
         */
        public static final String BROADCAST = "BROADCAST";
        
        /**
         * 系统通知
         */
        public static final String SYSTEM = "SYSTEM";
        
        /**
         * 错误消息
         */
        public static final String ERROR = "ERROR";
    }
    
    /**
     * 客户端状态
     */
    public static class ClientStatus {
        /**
         * 连接中
         */
        public static final String CONNECTING = "CONNECTING";
        
        /**
         * 已认证
         */
        public static final String AUTHENTICATED = "AUTHENTICATED";
        
        /**
         * 已断开
         */
        public static final String DISCONNECTED = "DISCONNECTED";
    }
    
    /**
     * 系统配置Key
     */
    public static class ConfigKey {
        /**
         * 最大连接数
         */
        public static final String MAX_CONNECTIONS = "max_connections";
        
        /**
         * 单IP最大连接数
         */
        public static final String MAX_CONNECTIONS_PER_IP = "max_connections_per_ip";
        
        /**
         * 心跳超时时间(秒)
         */
        public static final String HEARTBEAT_TIMEOUT = "heartbeat_timeout";
    }
    
    /**
     * 安全相关常量
     */
    public static class Security {
        /**
         * JWT Token前缀
         */
        public static final String TOKEN_PREFIX = "Bearer ";
        
        /**
         * 角色前缀
         */
        public static final String ROLE_PREFIX = "ROLE_";
        
        /**
         * 管理员角色
         */
        public static final String ROLE_ADMIN = "ROLE_ADMIN";
        
        /**
         * 操作员角色
         */
        public static final String ROLE_OPERATOR = "ROLE_OPERATOR";
    }
} 